<template>
  <div class="choose-container">
    <div class="content">
      <itemTags :type="index" @checked="changeHandler" :key="id"></itemTags>
      <div class="btn-group">
        <div class="cancle" @click="refresh">取消</div>
        <div class="right" @click="allright">确定</div>
      </div>
    </div>
  </div>
</template>

<script>
// api
import { getProjectList } from "@/api/miva";
// item
import itemTags from "@/components/item-tags";
export default {
  components: {
    itemTags
  },
  props: {
    index: {
      type: Number,
      default: 1
    }
  },
  data() {
    return {
      show: true,
      dataList: [],
      id: +new Date()
    };
  },
  async mounted() {
    await this.getProjectList();
  },
  methods: {
    async getProjectList() {
      const res = await getProjectList({ type: 1 });
      this.dataList = res.data;
    },
    changeHandler(data) {
      this.dataList = data;
    },
    refresh() {
      // this.$emit("close");
      this.id = +new Date()
    },
    allright() {
      this.$emit("close");
    },
  //   refresh: function () {
  //   this.id = +new Date()
  //  },
  }
};
</script>

<style lang="less">
.choose-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99;
  .content {
    background: #fff;
    width: 85%;
    height: 100vh;
    margin-right: 0px;
    padding: 5px;
    box-sizing: border-box;
    overflow-y: scroll;
    float: right;
  }
  .btn-group {
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid;
    font-size: 12px;
    padding-top: 5%;
    .cancle,
    .right {
      border: 1px solid;
      padding: 5px 25px;
      background: #fff;
      color: #b2b2b2;
      border-radius: 15px;
    }
    .right {
      background: #ff0d2b;
      color: #fff;
    }
  }
}
</style>